#coding:utf-8
__author__ = '自之梦'

"""
@author:自之梦
@time: 17/5/25 上午10:26

#运单信息通知接口
"""
import random
import time

def Ma5_Val(str, val_type=""):
    #MD5加密
    import hashlib
    import types
    if type(str) is types.StringType:
        md5 = hashlib.md5()
        md5.update(str)
        if val_type == "upper":
            return md5.hexdigest().upper()
        else:
            return md5.hexdigest()
    else:
        return "errorCode: parameter1 must be str "

def Data_Key_Sort(data):
    #字典key排序
    result=sorted(data.items(), key=lambda item:item[0])
    test=""
    print result
    for i in result:
        test = test+ "=".join(i)
    return test



if __name__ =="__main__":

    result =Data_Key_Sort({"url":"http://119.147.84.81/com.uc56.uop.main/gateway/gateway.action","partner":"80228999","security_key":"b1f5ac5ea753f530a0c10868be523526","customerId":"80228999","checkCode":"25e3468e6499822727fae5a72e00a601","createOrder":"F","bindFlag":"1"})

    #print result


"""
['data_digest: 7eva%2FWU9u9JY%2FXP4UFOi%2FA%3D%3D',
'logistics_interface: %3CItemInfoQueryRequestDown%3E%3Ccheckword%3Echeckword%3C%2Fcheckword%3E%3CserialNumber%3E00001%3C%2FserialNumber%3E%3CwarehouseCompanyCode%3ELCSFPZ%3C%2FwarehouseCompanyCode%3E%3CcompanyCode%3EALOG%3C%2FcompanyCode%3E%3CpageIndex%3E1%3C%2FpageIndex%3E%3CitemCodeList%3E%3CitemCode%3E%3C%2FitemCode%3E%3C%2FitemCodeList%3E%3C%2FItemInfoQueryRequestDown%3E']



data={"name":"lili","age":"23","sex":"1"}
    result=sorted(data.items(), key=lambda item:item[0])
    test=""
    for i in result:
        test = test+ "".join(i)
    print test

"""
